home *** CD-ROM | disk | FTP | other *** search
- Path: loria.fr!usenet
- From: roegel@loria.fr (Denis B. Roegel)
- Newsgroups: comp.lang.c
- Subject: scanf/gets interaction ?
- Date: 25 Mar 1996 17:05:14 GMT
- Organization: CRIN & INRIA-Lorraine - Nancy - FRANCE
- Message-ID: <4j6joa$6ve@muller.loria.fr>
- NNTP-Posting-Host: pandore.loria.fr
- Mime-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-1
- Content-Transfer-Encoding: 8bit
- X-newsreader: xrn 8.01
-
- I have the following program:
-
- #include <stdio.h>
-
- main(){
- int n;
- char num[10];
- char*r;
- fflush(stdin);
- printf("n: ");scanf("%i",&n);
- printf("Numero ? ");r = gets(num);
- printf("Bien recu!\n");
- }
-
- which I compile with gcc on SunOS. The program asks for a first number n which
- I enter. But I never get a chance of entering a second one. Why is this so ?
-
- Thanks in advance,
-
- Denis
-